﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PerCederberg.Grammatica.Runtime;

namespace SafeScript.MetaModel
{
    class Helper
    {
        public static Node GetNode(Node node, SafeScript.SafeScriptConstants id)
        {
            for (int i = 0; i < node.Count; ++i)
            {
                Node n = node[i];
                if (n.Id == (int)id)
                    return n;
            }
            return null;
        }

        public static Token GetToken(Node node, SafeScript.SafeScriptConstants id)
        {
            Node result = GetNode(node, id);
            return result as Token;
        }
    }
}
